﻿using System.Collections.Generic;

namespace com.binance.client.model.enums
{
	public sealed class QuerySort
	{

	  public static readonly QuerySort ASC = new QuerySort("ASC", InnerEnum.ASC, "asc");
	  public static readonly QuerySort DESC = new QuerySort("DESC", InnerEnum.DESC, "desc");

	  private static readonly IList<QuerySort> valueList = new List<QuerySort>();

	  static QuerySort()
	  {
		  valueList.Add(ASC);
		  valueList.Add(DESC);
	  }

	  public enum InnerEnum
	  {
		  ASC,
		  DESC
	  }

	  public readonly InnerEnum innerEnumValue;
	  private readonly string nameValue;
	  private readonly int ordinalValue;
	  private static int nextOrdinal = 0;

	  private readonly string code;

	  internal QuerySort(string name, InnerEnum innerEnum, string code)
	  {
		this.code = code;

		  nameValue = name;
		  ordinalValue = nextOrdinal++;
		  innerEnumValue = innerEnum;
	  }

	  public string Code
	  {
		  get
		  {
			return code;
		  }
	  }

		public static IList<QuerySort> values()
		{
			return valueList;
		}

		public int ordinal()
		{
			return ordinalValue;
		}

		public override string ToString()
		{
			return nameValue;
		}

		public static QuerySort valueOf(string name)
		{
			foreach (QuerySort enumInstance in QuerySort.valueList)
			{
				if (enumInstance.nameValue == name)
				{
					return enumInstance;
				}
			}
			throw new System.ArgumentException(name);
		}
	}

}